package com.csust.travel.mapper;

import org.apache.ibatis.annotations.Select;

public interface StatisticsMapper {
    @Select("select bought from statistics where user_id= #{user_id}")
    Integer getBought(Integer user_id);

    @Select("select comments from statistics where user_id= #{user_id}")
    Integer getComments(Integer user_id);

    @Select("select favorites from statistics where user_id= #{user_id}")
    Integer getFavorites(Integer user_id);

    @Select("select published from statistics where user_id= #{user_id}")
    Integer getPublished(Integer user_id);

    @Select("select sold from statistics where user_id= #{user_id}")
    Integer getSold(Integer user_id);

    @Select("SELECT COUNT(*) AS count\n" +
            "FROM books\n" +
            "WHERE owner = #{owner} and hasPublish=1")
    Integer getHasPublished(Integer owner);

    @Select("select count(*) as count from transactions where buyer_id = #{buy_id} and hasCommented = 0 ")
    Integer getReviewing(Integer buyer_id);
}
